#ifndef _DISK_H_
#define _DISK_H_

#include "file.h"
#include "folder.h"
#include "filesystemerror.h"

#include <QObject>
#include <QList>
#include <QString>

/**
 * TODO:
 * Todas as funcoes tem que atualizar, checar ou criar os .tubox/files,folders.
 * Implementar o resto das funcoes.
 */

namespace Tubox {

class Daemon;
class Action;

class Disk : public QObject, public Folder {
Q_OBJECT
public:
	Disk(const QString& path, Daemon* daemon);
  ~Disk();

	/**
	* Will find modifications and inconsistencies.
	 */
	QList<Action*> check();

	void save(File& file, const bool saveData = true) throw(FileSystemError);
	void remove(const File& file) throw(FileSystemError);
	void remove(const Folder& folder) throw(FileSystemError);
	void move(const QString& oldPath, const QString& newPath) throw(FileSystemError);
	void move(const Folder& oldFolder, const Folder& newFolder) throw(FileSystemError);
	void move(const File& oldFile, const File& newFile) throw(FileSystemError);
	void update(File& file, const bool saveData = true) throw(FileSystemError);
	void create(const Folder& folder) throw(FileSystemError);

	QString getAbsolutePath() { return absolutePath; }
private:
	QString absolutePath;
	Daemon* daemon;
};

}

#endif // DISK_H
